package com.nf.teamwork.mall.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: LJP
 * @Classname ResponseVO
 * @Date: 2020-03-01 19:11
 * @Description: 响应VO类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("响应VO类(ResponseVO)")
public class ResponseVO {
    @ApiModelProperty("响应码(code)")
    private Integer code;
    @ApiModelProperty("响应信息(message)")
    private String message;
    @ApiModelProperty("响应数据(data)")
    private Object data;

    private ResponseVO(Builder builder) {
        setCode(builder.code);
        setMessage(builder.message);
        setData(builder.data);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static Builder newBuilder(ResponseVO copy) {
        Builder builder = new Builder();
        builder.code = copy.getCode();
        builder.message = copy.getMessage();
        builder.data = copy.getData();
        return builder;
    }


    public static final class Builder {
        private Integer code;
        private String message;
        private Object data;

        private Builder() {
        }

        public Builder code(Integer val) {
            code = val;
            return this;
        }

        public Builder message(String val) {
            message = val;
            return this;
        }

        public Builder data(Object val) {
            data = val;
            return this;
        }

        public ResponseVO build() {
            return new ResponseVO(this);
        }
    }
}
